package org.youyun56.gpsserver.command;

import java.sql.SQLException;

import org.apache.log4j.Logger;
import org.youyun56.gpsserver.Task;
import org.youyun56.gpsserver.db.DBHeper;
import org.youyun56.gpsserver.entity.Car;

public class LoginExecutor extends Task {

    private final static Logger log = Logger.getLogger(LoginExecutor.class);

    @Override
    public Object execute() {
        String carId = command.getParameters().get("carId");
        String pwd = command.getParameters().get("pwd");
        try {
            Car car = DBHeper.carDao.findCar(carId, pwd);
            return car;
        }
        catch (SQLException e) {
            log.error(e.getMessage(), e);
            return null;
        }

    }

}
